package com.yao.mapper;

import com.yao.pojo.Article;
import com.yao.pojo.ArticleQuery;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ArticleMapper {

    /**
     * 根据条件查找找文章
     * @param articleQuery
     * @return
     */
    List<Article> selectArticle(ArticleQuery articleQuery);

    /**
     * 发布文章
     * @param article
     */
    void addArticle(Article article);

    /**
     * 根据ID查找文章信息
     * @param id
     */
    @Select("select * from article where id = #{id}")
    Article findEqualArticle(Integer id);

    /**
     * 修改文章
     * @param article
     */
    void changeArticle(Article article);

    /**
     * 根据ID删除文章
     * @param id
     */
    @Delete("delete from article where id = #{id}")
    void deleteArticle(Integer id);
}
